home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / plain C OS8 / AMReminder / AMReminderApp.c < prev    next >
Encoding:
Text File  |  1998-10-29  |  1.6 KB  |  108 lines  |  [TEXT/CWIE]

  1. // AMReminderApp.c -- application-level functions
  2.  
  3. #include <Types.h>
  4. #include <Quickdraw.h>
  5. #include <Controls.h>
  6. #include <Events.h>
  7. #include <Lists.h>
  8. #include <Menus.h>
  9. #include <TextEdit.h>
  10. #include <stdlib.h>
  11.  
  12. #include "ResourceDefs.h"
  13. #include "Dispatcher.h"
  14.  
  15. #include "AMReminderEngine.h"
  16. #include "AMReminderDoc.h"
  17. #include "AMWindow.h"
  18. #include "AMReminderApp.h"
  19.  
  20.  
  21. //----------
  22. AMReminderApp*        NewAMReminderApp ()
  23. {
  24.     AMReminderApp*        app;
  25.  
  26.     app = (AMReminderApp*)malloc (sizeof (AMReminderApp));
  27.     AMReminderApp_Init (app);
  28.     SetClassID (app, classAMReminderApp);
  29.  
  30.     return app;
  31. }
  32.  
  33. //----------
  34. void    DeleteApp (
  35.     AMApp*        app)
  36. {
  37.     AMReminderApp_Free ((AMReminderApp*)app);
  38.     free (app);
  39. }
  40.  
  41. /*----------*/
  42. void    AMReminderApp_Init (
  43.     AMReminderApp*        self)
  44. {
  45.     AMApp_Init ((AMApp*) self);
  46.  
  47.     self->super.mNumOpenTypes = 1;
  48.     self->super.mOpenTypeList [0] = kFileType;
  49. }
  50.  
  51. /*----------*/
  52. void    AMReminderApp_Free (
  53.     AMReminderApp*        self)
  54. {
  55.     AMApp_Free ((AMApp*) self);
  56. }
  57.  
  58. /*----------*/
  59. AMDoc*        MakeDoc (
  60.     AMApp*        self)
  61. {
  62.     AMReminderDoc*        doc = NewAMReminderDoc ();
  63.  
  64.     if (doc != nil) {
  65.         //? add to list of docs
  66.     }
  67.  
  68.     return (AMDoc*) doc;
  69. }
  70.  
  71. /*----------*/
  72. void    OpenApp (
  73.     AMApp*        self)
  74. {
  75.     DoNew (self);
  76. }
  77.  
  78. //----------
  79. Boolean        DoAppCommand (
  80.     AMApp*        self,
  81.     long        inCommand)
  82. {
  83.     Boolean        result = true;
  84.  
  85.     switch (inCommand) {
  86.         case cmdAbout:
  87.                 DoAbout (self);
  88.             break;
  89.         case cmdNew:
  90.                 DoNew (self);
  91.             break;
  92.         case cmdOpen:
  93.                 DoOpen (self);
  94.             break;
  95.         case cmdClose:
  96.                 DoClose (self);
  97.             break;
  98.         case cmdQuit:
  99.                 DoQuit (self);
  100.             break;
  101.  
  102.         default:
  103.                 result = false;
  104.     } // case
  105.  
  106.     return result;
  107. }
  108.